{
  "nbformat": 4,
  "nbformat_minor": 0,
  "metadata": {
    "colab": {
      "provenance": []
    },
    "kernelspec": {
      "name": "python3",
      "display_name": "Python 3"
    },
    "language_info": {
      "name": "python"
    }
  },
  "cells": [
    {
      "cell_type": "code",
      "source": [],
      "metadata": {
        "id": "WxIDrhMMXq26"
      },
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [],
      "metadata": {
        "id": "Z1a10hWnYoLa"
      },
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "import glob\n",
        "import cv2\n",
        "import pandas as pd\n",
        "import pathlib"
      ],
      "metadata": {
        "id": "C02b4jGfYoN3"
      },
      "execution_count": 9,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "def read_qr_code(filename):\n",
        "    \"\"\"Read an image and read the QR code.\n",
        "\n",
        "    Args:\n",
        "        filename (string): Path to file\n",
        "\n",
        "    Returns:\n",
        "        qr (string): Value from QR code\n",
        "    \"\"\"\n",
        "\n",
        "    try:\n",
        "        img = cv2.imread(filename)\n",
        "        detect = cv2.QRCodeDetector()\n",
        "        value, points, straight_qrcode = detect.detectAndDecode(img)\n",
        "        return value\n",
        "    except:\n",
        "        return"
      ],
      "metadata": {
        "id": "9WBkKxI_YoP7"
      },
      "execution_count": 10,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "value = read_qr_code('/content/drive/MyDrive/download.png')"
      ],
      "metadata": {
        "id": "WOwG1cGfYoSA"
      },
      "execution_count": 11,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "value"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 35
        },
        "id": "DSeW4gTTYoUU",
        "outputId": "6f300523-60fa-4cae-d708-83dad8354c23"
      },
      "execution_count": 12,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "'http://en.m.wikipedia.org'"
            ],
            "application/vnd.google.colaboratory.intrinsic+json": {
              "type": "string"
            }
          },
          "metadata": {},
          "execution_count": 12
        }
      ]
    }
  ]
}